﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LoungeRepo.Contracts.Core;
using LoungeRepo.Core;

namespace Performancetest
{
    class Address
    {
        public string StreetAddress;
        public string City;
        public string ZIP;
    }

    class Contact
    {
        public string Name;
        public List<Address> Addresses = new List<Address>();
    }


    class Program
    {
        static void Main(string[] args)
        {
            using(var repo = new LoungeRepository(new LoungeRepoConfig{EnableLogging=true}))
            {
                var s = DateTime.Now;

                for(int i = 0; i<5000; i++)
                {
                    var ctct = new Contact { Name = "some name" + (i % 100).ToString() + DateTime.Now.Second.ToString() };
                    ctct.Addresses.Add(new Address { StreetAddress = "some street1", City = "some city", ZIP = "22299" });
                    ctct.Addresses.Add(new Address { StreetAddress = "some street2", City = "some city", ZIP = "22299" });
                    ctct.Addresses.Add(new Address { StreetAddress = "some street3", City = "some city", ZIP = "22299" });

                    repo.Store(ctct, i.ToString(), "contacts");
                }

                Console.WriteLine(DateTime.Now.Subtract(s));
            }
        }
    }
}
